<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of BM
 *
 * @author ID59C
 */
class BAppDbActiveRecord extends CActiveRecord {

    private static $appDb = null;
    protected $_errors=array();

    public function getDbConnection() {
        if (self::$appDb !== null)
            return self::$appDb;
        else {
            self::$appDb = Blyn::app()->getActiveServiceApp()->getDbAdapter()->getConnection();
            if (self::$appDb instanceof CDbConnection)
                return self::$appDb;
            else
                throw new CDbException(Yii::t('yii', 'Active Record requires a "db" CDbConnection application component.'));
        }
    }

}

?>
